home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / Prograph Reference Manual.sit / Prograph Reference Manual / Prograph Reference 8-End.rsrc / TEXT_148.txt < prev    next >
Text File  |  1995-10-26  |  28KB  |  543 lines

  1.  Appendix IV
  2.  
  3.  Syntax and Semantics  *593*
  4.  
  5.  t Definitions and Notation
  6.  t Syntax
  7.  t Semantics - See next section
  8.  
  9. In this appendix, the syntax and semantics of Prograph are presented, as far as is practical, in an abstract form, free from representation issues. In a particular implementation, the entities that constitute a Prograph program are represented by symbols or pictures. We suggest that while following the description of syntax below, the reader consult chapter 8, 窶弃ictopedia,窶 to match syntactic elements with their appearance in the Macintosh implementation.  
  10.  
  11. As is the case with any programming language, some low-level details depend on the implementation environment, so at a certain point our description becomes more concrete, to deal with these aspects of the Macintosh implementation. Generally, we refer the reader to other chapters of this manual as appropriate.
  12.  
  13. Although the Prograph language is extremely powerful, the simple pictorial interface that makes this power readily accessible also disguises the complexity of the underlying concepts.  Natural languages such as English are not designed for describing such things.  Their punctuation and syntax cannot stretch to expressing complicated conditions, and the nomenclature they provide, such as the articles 窶徼he窶 and 窶彗,窶 is not up to the task of unambiguously identifying all the items necessary to an explanation.  So in order to precisely describe these concepts and to ensure that the structure and function of Prograph programs are clearly and unambiguously defined, we need compact notation and terminology that cannot be misunderstood.  The material in this chapter may therefore appear terse and mathematical; however, it is all defined here, so no prior knowledge of any specific mathematical concepts is required.  Time invested in appreciating these definitions will be well repaid later with a clear understanding of what Prograph is and what it does.  
  14.  
  15. Wherever possible, the concepts described are related to corresponding concepts in other languages or are accompanied by informal explanatory comments.
  16.  
  17. t    Definitions and Notation *594*
  18.  
  19. Certain entities in a program are referred to as elements:    namely classes, attributes, methods, cases, operations, roots, terminals and persistents. 
  20.  
  21. The word 窶徼uple窶 is used to mean an ordered set of (not necessarily distinct) items, its standard meaning in mathematics. It can be preceded by an integer indicating the size:   for example, (), (dog), (old, new), (1, 2, 3) are respectively, a 0-tuple, 1-tuple, 2-tuple, and 3-tuple. The words 窶徘air窶 and 窶徼riple窶 are used as synonyms for 窶œ2-tuple窶 and 窶œ3-tuple,窶 respectively.  If x is either a tuple or a Prograph list, |x| denotes the size of x, and if i is an integer ranging from 1 to |x|, x[i] denotes the member of x in position i.  The word 窶徭equence窶 is used as a synonym for 窶徼uple.窶
  22.  
  23. Prograph programs and certain elements consist of (possibly nested) sets of elements. No element is a member of more than one such set, so we can, without ambiguity, use phrases of the form 窶徼he X of a Y,窶 where Y is a member of some set that is a constituent of an element X:   for instance 窶徼he method of a case.窶
  24.  
  25. All elements except roots, terminals, and operations Input and Output have names. A set of named elements is said to be unambiguous if and only if no two elements in the set have the same nonempty string as their names.
  26.  
  27. Certain elements have two associated integers, the inarity and outarity. If m and k are the inarity and outarity of an element, respectively, then the pair (m,k) is called the arity of the element. 
  28.  
  29. An identifier is any string of characters that neither begins nor ends with <space>, where <space> is as defined in the 窶弖alues窶 section below in this appendix.
  30.  
  31. A reference is on of the following:   *594*
  32.  
  33. o an explicit reference, which is a string of the form <class>/<method>, where <class> is a nonempty identifier not containing the character /, and <method> is a nonempty identifier
  34.  
  35. o a context-determined reference, which is a string of the form //<method>, where <method> is a nonempty identifier
  36.  
  37. o a data-determined reference, which is a string of the form /<method>, where <method> is a nonempty identifier
  38.  
  39. o a universal reference, which is any identifier not included in the above three definitions
  40.  
  41. t    Syntax *595*
  42.  
  43.  Values
  44.  
  45. A value is either a simple value or a compound value.
  46.  
  47. A simple value is a string of characters defined by the following grammar in Backus-Naur Form, where nonterminal symbols defining classes of strings are enclosed in < and >, and | separates alternative productions. For some nonterminal symbols we give a descriptive definition if a formal one would be obscure or tedious. 
  48.  
  49.  <simple value> :  :  =     <delimited value> | <default string>
  50.  
  51.  <string> :  :  =     <quoted string> | <atomic string> | <default string> 
  52.  
  53.  <default string> :  :  =    any string which is not a <delimited value>
  54.  
  55.  <delimited value> :  :  =     <quoted string> | <atomic string> | <integer> | <real> | 
  56.                                 <boolean> | <null> | <undefined> | <none> | <list> | <simple mac>
  57.  
  58.  <atomic string> :  :  =     any <atom> other than FALSE, TRUE, NULL, UNDEFINED, or   
  59.                                       NONE
  60.  
  61.  <boolean> :  :  =    FALSE | TRUE
  62.  
  63.  <null> :  :  =     NULL
  64.  
  65.  <undefined> :  :  =    UNDEFINED
  66.  
  67.  <none> :  :  =    NONE
  68.  
  69.  <list> :  :  =     (<value*>)
  70.  
  71.  <value*> :  :  =     <delimited value> <space><value*> | <delimited value> | <empty>
  72.  
  73.  <simple mac> :  :  =     <point> | <rectangle> | <RGB>
  74.  
  75.  <point> :  :  =     {<integer> <space> <integer>}
  76.  
  77.  <rectangle> :  :  =     {<integer> <space> <integer> <space> <integer> <space> <integer>} *596*
  78.  
  79.  <RGB> :  :  =     {<integer> <space> <integer> <space> <integer>}
  80.  
  81.  <space> :  :  =     any nonempty string of characters whose ASCII values are less than or 
  82.                             equal to that of blank
  83.  
  84.  <quoted string> :  :  =     "<no double>"<quoted string> | "<no double>"
  85.  
  86.  <no double> :  :  =     any string of characters, except "
  87.  
  88.  <atom> :  :  =     <letter atom> | <special atom>
  89.  
  90.  <letter atom> :  :  =     <letter> <alphanumeric> | <letter>
  91.  
  92.  <special atom> :  :  =     any nonempty string of characters having ASCII values greater 
  93.                                   than that of blank except those included in <alphanumeric>
  94.  
  95.  <integer> :  :  =     <sign> <unsigned integer> *596*
  96.  
  97.  <unsigned integer> :  :  =     <decimal integer> | <based integer> | <ascii integer>
  98.  
  99.  <decimal integer> :  :  =     <digit> <spaced digits>
  100.  
  101.  <spaced digits> :  :  =     <digit> <spaced digits> | _<spaced digits> | <empty>
  102.  
  103.  <based integer> :  :  =     <digit+>#<alphanumeric>
  104.  
  105.  <alphanumeric> :  :  =     <letter> <alphanumeric> | <digit> <alphanumeric> |  <letter> |   
  106.                                                          <digit>
  107.  
  108.  <letter> :  :  =     a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | _
  109.  
  110.  <ascii integer> :  :  =     '<no single>' | '<no single><no single>' | □'<no single><no 
  111.                                        single><no single><no single>'
  112.  
  113.  <no single> :  :  =     any string of characters having ASCII values greater than that of 
  114.                                  blank, except ' | ' ' 
  115.  
  116.  <real> :  :  =     <sign> <mantissa> <exponent>
  117.  
  118.  <mantissa> :  :  =     <digit+> | <digit+>.<digit*> | <digit*>.<digit+>
  119.  
  120.  <exponent> :  :  =     e<sign> <digit+> | E<sign> <digit+> | <empty> *596*
  121.  
  122.  <sign> :  :  =     + | - | <empty> *597*
  123.  
  124.  <digit*> :  :  =     <digit+> | <empty>
  125.  
  126.  <digit+> :  :  =     <digit> <digit*>
  127.  
  128.  <digit> :  :  =     0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
  129.  
  130.  <empty> :  :  =     the empty string
  131.  
  132. A compound value is a compound list, a direct Macintosh value, an indirect Macintosh value, or an instance of a class.
  133.  
  134. A compound list is a tuple of values, at least one of which is compound.
  135.  
  136. Macintosh values are directly or indirectly referenced Macintosh records. These are specific to the implementation environment and are not discussed here. See Inside Macintosh for details.
  137.  
  138. An instance D of a class C is a set of attributes in one-to-one correspondence with the set of instance attributes of C, such that corresponding attributes from D and C have the same name (see the definition of 窶彡lass窶 below).
  139.  
  140. The primitive data types in Prograph are the following:    boolean, integer, list, none, null, real, string, and undefined (see appendix I,窶œ Prograph Data Types窶). *597*
  141.  
  142.  Program *597*
  143.  
  144. A Prograph program consists of:  
  145.  
  146. o an unambiguous set of externals, partitioned into a set of primitives and a set of Mac Methods
  147.  
  148. o an unambiguous set of persistents
  149.  
  150. o a class hierarchy, consisting of an unambiguous set C of classes together with a set I of pairs of classes in C with the property that if (c1,c2) and (c3,c2) are both in I, then c1= c3
  151.  
  152.  An element (c1,c2) of I is called an inheritance link from c1 to c2; c1 is called the superclass of c2; and c2 is called a subclass of c1. If c1 and c2 are classes, c1 is called an ancestor of c2 if and only if either c1 is the superclass of c2 , or c1 is an ancestor of some class c3 that is the superclass of c2 . If c1 is an ancestor of c2, then we say that c2 is a descendent of c1, and c2 inherits from c1.
  153.  
  154. o an unambiguous set of methods, called the universal methods of the program 
  155.  
  156.  External *598*
  157.  
  158. An external consists of an identifier called the name of the external, and two nonnegative integers called the inarity and outarity respectively.
  159.  
  160.  
  161. ___________________________________________
  162. NOTE:    Externals provide certain basic functions, and correspond to operators and built in procedures and functions of languages such as C or Pascal.  For example, the primitive + corresponds with the C or Pascal arithmetic operator +.  Mac Methods provide access to the Macintosh toolbox, like most language implementations on the Macintosh. 
  163. ___________________________________________
  164.  
  165.  Persistent *598*
  166.  
  167. A persistent consists of an identifier and a value, respectively called the name and value of the persistent.
  168.  
  169.  
  170. ___________________________________________
  171. NOTE:    A Prograph persistent plays the same role as global variables in such languages as C and Pascal.  It provides a convenient 窶徘igeonhole窶 to keep values for later use.  The difference, however, is that the value of a persistent is retained 
  172. between executions and is saved with the program. ___________________________________________
  173.  
  174.  Class *598*
  175.  
  176. A class consists of:  
  177.  
  178. o an identifier, called the name of the class, which cannot be the name of any primitive data type or Macintosh type, as listed in the Info menu
  179.  
  180. o an unambiguous set of attributes, partitioned into two sets, class attributes and instance attributes
  181.  
  182. 窶「    An attribute y of class Y is inherited if and only if it has the same name as some attribute x of the superclass of Y:   y is also said to inherit from x. An attribute that is not inherited is said to be locally defined.
  183.  
  184. 窶「    An attribute y of class Y descends from an attribute x of class X if and only if X is an ancestor of Y, x and y have the same name, and x is not inherited.
  185.  
  186. 窶「    If an attribute y inherits from an attribute x, then y is a class attribute if and only if x is a class attribute.  
  187.  
  188. 窶「    If Y is a subclass of X, then for every attribute x of X there is an attribute y of Y that inherits from x.
  189.  
  190. o four unambiguous sets of methods called, respectively, the Simple, Set, Get, and Initialization methods of the class
  191.  
  192. 窶「    There is at most one Initialization method, which has name <<>> and arity (1,1).  
  193.  
  194. 窶「    The arity of each Set method is (2,1).
  195.  
  196. 窶「    The arity of each Get method is (1,2).
  197.  
  198.  
  199. ___________________________________________
  200. NOTE:    Class hierarchies in Prograph are exactly comparable to class hierarchies in any other object-oriented language with single inheritance.  A hierarchy of classes forms a 窶彷orest of trees,窶 in which methods and attributes are inherited from the roots of the trees to the leaves.
  201.  
  202. ___________________________________________
  203.  
  204.  
  205.  Attribute *599*
  206.  
  207. An attribute consists of an identifier and a value, respectively called the name and value of the attribute.
  208.  
  209.  Method *599*
  210.  
  211. A method consists of an identifier, called the name of the method, and a sequence of cases all with the same arity. A method has an associated arity, which is the same as the arity of each of its cases.
  212.  
  213.  
  214. ___________________________________________
  215. NOTE:    Prograph methods are analogous to Smalltalk methods, Pascal procedures, functions in Lisp or C, and predicates in Prolog.
  216.  
  217. ___________________________________________
  218.  
  219.  
  220.  Case *599*
  221.  
  222. A case consists of:  
  223.  
  224. o A set of operations containing exactly one Input and exactly one Output, called the input bar and output bar respectively.  
  225.  
  226.  The inarity and outarity of the case are, respectively, the outarity of the input bar and the inarity of the output bar.  
  227.  
  228.  No operation precedes itself, where 窶徘recedes窶 is defined below.
  229.  
  230. o A set of datalinks, each of which is a pair of the form (r,t) where r and t are, respectively, a root and a terminal of some operations of the case. A datalink (r,t) is said to be from r to t. No terminal occurs in more than one datalink.
  231.  
  232. o A set of synchro links, each of which is a pair of operations of the case. A synchro link (o1,o2) is said to be from o1 to o2. Neither the input bar nor the output bar can occur in a synchro link.
  233.  
  234. If o1 and o2 are distinct operations , o1 precedes an operation o2 if and only if :  
  235.  
  236. 窶「    o1 is the input bar, or
  237.  
  238. 窶「    o2 is the output bar, or
  239.  
  240. 窶「    there is a synchro link from o1 to o2, or
  241.  
  242. 窶「    there is a datalink from a root of o1 to a terminal of o2, or
  243.  
  244. 窶「    o1 precedes some operation o3, which precedes o2.
  245.  
  246.  
  247. ___________________________________________
  248. NOTE:    A case is loosely analogous to the if-then construct in familiar structured languages such as Pascal.  A sequence of cases in Prograph is also analogous to a COND in Lisp.  In a case, however, the computations associated with testing conditions are intermingled with those that compute values, and do not necessarily have to return TRUE or FALSE, unlike in if-thens or CONDs.  The sequence of cases defining a method is strictly analogous to the sequence of clauses that define a predicate in Prolog.
  249.  
  250. A case consists of a network of operations connected by datalinks; these distribute data from the roots of operations that produce it to the terminals of operations that use it.  
  251. The order in which the operations are executed must therefore be such that no attempt is made to execute an operation before its input data are available.  The execution order of operations in a case is further constrained by synchro links.  The programmer can use synchros to ensure that two operations are executed in a particular order, if this order is important, as it may be if side effects are involved, such as graphics or assigning values to attributes.
  252.  
  253. The input and output bars provide communication between the case and the outside world.  The input bar copies the values from the terminals of the calling operation onto its own roots, and from there they are distributed to the terminals of operations in the case.  The output bar copies the values on its terminals to the roots of the calling operation.
  254. ___________________________________________
  255.  
  256.  
  257.  Operation
  258.  
  259. General *601*
  260.  
  261. An operation is a set of components, which always includes the following:  
  262.  
  263. o Mode, the mode, which is either Plain or Repeat. An operation that has mode Repeat is also called a multiplex.
  264.  
  265. o Control, a control, which consists of:  
  266.  
  267. 窶「    a trigger, which is either Success or Failure
  268.  
  269. 窶「    an action, which is one of Next Case, Terminate, Finish, Continue, or Fail
  270.  
  271.  We frequently refer to a control with action A and trigger T by the phrase 窶廣 on T,窶 for example, 窶廸ext Case on Failure.窶
  272.  
  273.      Note that the control 窶廚ontinue on Success窶 is the default and has no pictorial representation in the implementation of Prograph.
  274.  
  275. o Terminals, the sequence of terminals. The length of this sequence is called the inarity of the operation.  
  276.  
  277.  Every terminal has a mode, which is Simple, List, or Loop.  
  278.  
  279.  One terminal can be the name of the operation; if so, it is called an inject terminal.
  280.  
  281. o Roots, the sequence of roots. The length of this sequence is called the outarity of the operation.  
  282.  
  283.  Every root has a mode, which is Simple, List, Loop, True, or False.
  284.  
  285. Every operation, with the exception of Input and Output, also includes the following:  
  286.  
  287. o Name, the name. This can be one of the terminals in T.
  288.  
  289. All the above are called standard components. Simple operations also include the following:  
  290.  
  291. o Search, the search origin, which is either Normal or Super.
  292.  
  293. Throughout the rest of this chapter, whenever the words Mode, Control, Terminals, Roots, Name, or Search are used in reference to an operation, they denote an appropriate component of this operation as defined above.
  294.  
  295.  
  296. ___________________________________________
  297. NOTE:    The terminals and roots of an operation signify input values and output results.  They correspond approximately to the parameters of functions and procedures in C and Pascal, and to the parameters of goal literals in Prolog.  In contrast to parameters in these languages, however, the inputs and outputs of an operation in Prograph are clearly distinguished.  There is a closer analogy in Lisp:   the parameters of a Lisp function evaluation correspond to terminals of an operation, while the single output of a function evaluation corresponds with a single root.
  298.  
  299. Every operation has an associated control.  The default control is Continue on Success, which has no pictorial representation in the implementation of Prograph.  The control interprets any condition that arises during the execution of the operation to determine how such a condition should affect the progress of execution.  The closest analogy to this in other languages is the use of failure in Prolog:   we can consider that every goal literal in Prolog has the associated control Backtrack on Failure.
  300.  
  301. The name of an operation depends on the category to which the operation belongs.  It can be a value, an expression, a terminal, or a string that refers to another Prograph element such as a method, attribute or persistent. In the case of a terminal, the identity of the operation is determined at execution time from the string that arrives at this terminal.
  302. ___________________________________________
  303.  
  304. Every operation satisfies the following conditions:  
  305.  
  306. o The number of Loop roots equals the number of Loop terminals. The sequential order of roots and terminals therefore induces a one-to-one correspondence between Loop terminals and Loop roots. We say that a Loop terminal and Loop root correspond if they are matched by this mapping.
  307.  
  308. o If there is a True or False root, then Roots consists of exactly two roots, the first having mode True and the second False, and Terminals contains exactly one List terminal, which cannot also be an inject terminal.
  309.  
  310. o If there is a root or terminal of mode List or Loop, then the mode of the operation is Repeat.
  311.  
  312.  
  313. ___________________________________________
  314. NOTE:    Matching Loop roots and terminals represent values that are iterated when an operation is executed as a multiplex.  They correspond to loop variables in structured languages such as C and Pascal.
  315. ___________________________________________
  316.  
  317. An operation is either a Simple operation, Get, Set, Instance generator, Persistent operation, Local, Evaluation, Input, Output, Constant, Match, or Environment. Environment operations are specific to the implementation environment. In the Macintosh implementation, an Environment operation is one of Mac Constant, Mac Match, Mac Global, Mac Address, Mac Get Field, or Mac Set Field.
  318.  
  319. Simple *603*
  320.  
  321. A Simple consists of the standard components together with Search where:  
  322.  
  323. o Name is an identifier or an inject terminal.
  324.  
  325. o Search, which is Super only if Name is the empty string or a context-determined reference.
  326.  
  327.  
  328. ___________________________________________
  329. NOTE:    Simple operations are equivalent to calls to procedures and functions in languages like C and Pascal, to goal literals in Prolog, and to messages in Smalltalk.
  330. ___________________________________________
  331.  
  332.  
  333. Get *603*
  334.  
  335. A Get consists of the standard components where:  
  336.  
  337. o Name is a universal reference, a data-determined reference, or an inject terminal.
  338.  
  339. o Arity is (1,2).
  340.  
  341. o Each root is either Simple or List.
  342.  
  343.  
  344. ___________________________________________
  345. NOTE:    A Get corresponds exactly to retrieving the value of  the field of a record or structure in C, Pascal, or Smalltalk.  There are no precisely analogous actions in Lisp or Prolog, although retrieving the value of a property in Lisp or binding a variable to a subterm of some Prolog structure are similar.
  346. ___________________________________________
  347.  
  348.  
  349. Set *603*
  350.  
  351. A Set consists of the standard components where:  
  352.  
  353. o Name is a universal reference, a data-determined reference, or an inject terminal.
  354.  
  355. o Arity is (2,1).
  356.  
  357. o Each root is either Simple or List.
  358.  
  359.  
  360. ___________________________________________
  361. NOTE:    A Set corresponds exactly to assigning a value to the field of a record or structure in C, Pascal, or Smalltalk.  Setting the value of a property in Lisp is similar.  There is no analogy in Prolog.
  362. ___________________________________________
  363.  
  364. Instance Generator *604*
  365.  
  366. An Instance generator consists of the standard components where:  
  367.  
  368. o Name is either an identifier or an inject terminal.
  369.  
  370. o Arity is (1,1).
  371.  
  372. o Each root is either Simple or List.
  373.  
  374.  
  375. ___________________________________________
  376. NOTE:    An Instance generator is analogous to a call to the function 窶從ew窶 in Pascal and Smalltalk, and NewHandle or NewPtr in C (in a Macintosh environment).  Lisp and Prolog have no analogous constructs.
  377. ___________________________________________
  378.  
  379.  
  380. Persistent  *604*
  381.  
  382. A Persistent operation consists of the standard components where:  
  383.  
  384. o Name is an identifier or an inject terminal.
  385.  
  386. o Inarity is at most 1.
  387.  
  388. o Outarity is at most 1.
  389.  
  390. o The root is either Simple or List, and is List only if there is a List terminal.
  391.  
  392. o Mode is Repeat only if there is a List terminal.
  393.  
  394.  
  395. ___________________________________________
  396. NOTE:    A Persistent operation with input arity 1 corresponds to assignment to a global variable in C, Pascal, and Smalltalk, and to SETQ in Lisp.  A persistent operation with outarity 1 corresponds to retrieving a value from a variable.  Prolog has no equivalent.
  397. ___________________________________________
  398.  
  399. Local  *604*
  400.  
  401. A Local consists of the standard components where:  
  402.  
  403. o Name is a sequence of cases, each having the same arity as the operation. This sequence of cases is also called the Local method corresponding to the Local operation.
  404.  
  405.  
  406. ___________________________________________
  407. NOTE:    In Prograph a nested conditional structure could be handled by defining a method that would be called only from one operation to implement the inner conditional.  Using a Local, however, makes this proliferation of named methods unnecessary by attaching the cases of the nested conditional directly to an operation.  In Pascal, C, and Smalltalk, nested conditionals are implemented by textually nesting if-then compound-statement constructs.  This textual nesting could be eliminated by turning the nested conditional into a procedure, which would be referenced only once. 
  408. In Prolog, nested conditionals are implemented by compound goals consisting of alternative goal literal sequences separated by ;.
  409.  
  410. The Name of a local as defined above should not be confused with its textual label, which serves purely as an informative comment (see chapter 8, 窶弃ictopedia窶).
  411. ___________________________________________
  412.  
  413.  
  414. Evaluation  *605*
  415.  
  416. An Evaluation consists of the standard components where:  
  417.  
  418. o Name is either the empty string or an expression defined by the grammar below, using the operations @ (exponentiation), +, - (binary and unary), *, /, // (integer division), % (remainder from integer division), & (bitwise AND), | (bitwise OR), ^ (bitwise exclusive OR), ~ (bitwise complement), << (left shift),      >> (right shift).  In this grammar, to avoid confusion with the symbol | which indicates alternative productions, we have used ! for the bitwise OR operator.  The symbol | is actually used for this operator in the names of Evaluations. Likewise we have used ツォ in place of << and ツサ in place of >>. 
  419.  
  420.  <expression> :  :  =     <!expression>
  421.  
  422.  <!expression> :  :  =     <!expression> ! <^strong> | <^weak> | <^strong>
  423.  
  424.  <^weak> :  :  =     <^weak> ^ <&strong> | <&weak>
  425.  
  426.  <^strong> :  :  =     <^strong> ^ <&strong> | <&strong>
  427.  
  428.  <&weak> :  :  =     <&weak> & <ツォstrong> | <ツォweak>
  429.  
  430.  <&strong> :  :  =     <&strong> & <ツォstrong> | <ツォstrong>
  431.  
  432.  <ツォweak> :  :  =     <ツォweak> <shiftop> <+strong> | <+weak>
  433.  
  434.  <ツォstrong> :  :  =     <ツォstrong> <shiftop> <+strong> | <+strong>
  435.  
  436.  <+weak> :  :  =     <+weak> <addop> <*strong> | <*weak>
  437.  
  438.  <+strong> :  :  =     <+strong> <addop> <*strong> | <*strong>
  439.  
  440.  <*weak> :  :  =     <*weak> <multop> <@strong> | <@weak>
  441.  
  442.  <*strong> :  :  =     <*strong> <multop> <@strong> | <@strong>
  443.  
  444.  <@weak> :  :  =     <weak operand> @ <@strong> | <weak operand>
  445.  
  446.  <@strong> :  :  =     <strong operand> @ <@strong> | <strong operand>
  447.  
  448.  <strong operand> :  :  =     <variable> | <real> | <integer> | ( <expression> )
  449.  
  450.  <weak operand> :  :  =     <unary> <operand>
  451.  
  452.  <shiftop> :  :  =    ツォ | ツサ
  453.  
  454.  <addop> :  :  =     + | -
  455.  
  456.  <multop> :  :  =     * | / | // | %
  457.  
  458.  <unary> :  :  =      + | - | ~
  459.  
  460. o If Name is not the empty string, inarity is equal to the largest index in the alphabet of the single letter operands occurring in Name. (Upper-case and lower-case versions of a letter are not distinguished.)
  461.  
  462. o Outarity is 1.
  463.  
  464. o The root is Simple, List, or Loop, and is List only if there is a List terminal.
  465.  
  466. o Mode is Repeat only if there is a List terminal.
  467.  
  468. o If there is a Loop terminal, there must also be a List terminal.
  469.  
  470. NOTE:    An Evaluation is analogous to an expression in C and uses the same operators.
  471.  
  472. Input  *606*
  473.  
  474. An Input consists of the standard components, except for Name, where:  
  475.  
  476. o Mode is Plain.
  477.  
  478. o Control is Continue on Success.
  479.  
  480. o Inarity is 0.
  481.  
  482. o Every root is Simple.
  483.  
  484. Output  *607*
  485.  
  486. An Output consists of the standard components except for Name, where:  
  487.  
  488. o Mode is Plain.
  489.  
  490. o Outarity is 0.
  491.  
  492. o Every terminal is Simple.
  493.  
  494. Constant  *607*
  495.  
  496. A Constant consists of the standard components where:  
  497.  
  498. o Name is a <simple value>.
  499.  
  500. o Mode is Plain.
  501.  
  502. o Control is Continue on Success.
  503.  
  504. o Arity is (0,1).
  505.  
  506. o The root is Simple.
  507.  
  508.  
  509. ___________________________________________
  510. NOTE:    A Constant is analogous to a constant in C and Pascal, to lists and constants in Lisp, and to ground terms in Prolog (terms containing no variables).
  511. ___________________________________________
  512.  
  513.  
  514. Match  *607*
  515.  
  516. A Match consists of the standard components where:  
  517.  
  518. o Name is a <simple value>.
  519.  
  520. o Arity is (1,0).
  521.  
  522. o Mode is Repeat only if the terminal is List.
  523.  
  524. o The root is Simple or List.
  525.  
  526.  
  527. ___________________________________________
  528. NOTE:    A Match is comparable in most other languages to a test for equality of a datum with a constant (or list in Lisp).  It corresponds more closely, however, to unification with a ground term in Prolog.
  529. ___________________________________________
  530.  
  531.  
  532. Mac Constant, Mac Match, Mac Global  *608*
  533.  
  534. A Mac Constant (Mac Match, Mac Global) is syntactically equivalent to a Constant (Match, Persistent operation), except that the name must be the name of a Macintosh constant (constant, global).  See Inside Macintosh for more information.
  535.  
  536. Mac Get Field, Mac Set Field  *608*
  537.  
  538. A Mac Get Field (Mac Set Field ) is syntactically equivalent to a Set (Get), except that N must be the name of a field of a Macintosh record (see Inside Macintosh), no root can be a List unless there is a List terminal, and there is an optional terminal for indexing into fields that are arrays.
  539.  
  540. Mac Address  *608*
  541.  
  542. A Mac Address is syntactically equivalent to a Mac Get Field except that the outarity is 1.
  543.